package com.schedualnew.mq.dto.common;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Res<T> implements Serializable {
    private int code;
    private String message;
    private T data;

    public static Res<?> Success() {
        return new Res<>(0, null, "成功!");
    }

    public static <E> Res Success(E data) {
        return new Res<>(0, null, data);
    }

    public static <E> Res Fail(String msg) {
        return new Res<E>(500, msg, null);
    }
}
